<?php

namespace JLPay\Models\Openmerch\Alipay;

use JLPay\Models\BaseResponse;

/**
 * 支付宝实名查询响应
 */
class RealnameAliQueryResponse extends BaseResponse
{
    protected ?string $applymentStatus = null;  // 申请状态
    protected ?string $qrcodeData = null;       // 二维码链接地址
    protected ?string $rejectParam = null;      // 驳回字段
    protected ?string $rejectReason = null;     // 审核驳回原因
    protected ?string $authorizeState = null;   // 授权状态

    /**
     * 构造函数
     *
     * @param array|null $responseArray
     */
    public function __construct(?array $responseArray = null)
    {
        parent::__construct($responseArray);
        
        if ($responseArray) {
            $this->applymentStatus = $responseArray['applyment_status'] ?? null;
            $this->qrcodeData = $responseArray['qrcode_data'] ?? null;
            $this->rejectParam = $responseArray['reject_param'] ?? null;
            $this->rejectReason = $responseArray['reject_reason'] ?? null;
            $this->authorizeState = $responseArray['authorize_state'] ?? null;
        }
    }

    /**
     * 获取申请状态
     *
     * @return string|null
     */
    public function getApplymentStatus(): ?string
    {
        return $this->applymentStatus;
    }

    /**
     * 获取二维码链接地址
     *
     * @return string|null
     */
    public function getQrcodeData(): ?string
    {
        return $this->qrcodeData;
    }

    /**
     * 获取驳回字段
     *
     * @return string|null
     */
    public function getRejectParam(): ?string
    {
        return $this->rejectParam;
    }

    /**
     * 获取审核驳回原因
     *
     * @return string|null
     */
    public function getRejectReason(): ?string
    {
        return $this->rejectReason;
    }

    /**
     * 获取授权状态
     *
     * @return string|null
     */
    public function getAuthorizeState(): ?string
    {
        return $this->authorizeState;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        $data = parent::toArray();
        $data['applyment_status'] = $this->applymentStatus;
        $data['qrcode_data'] = $this->qrcodeData;
        $data['reject_param'] = $this->rejectParam;
        $data['reject_reason'] = $this->rejectReason;
        $data['authorize_state'] = $this->authorizeState;
        return $data;
    }
} 